Fix handling of attrs[:managed] + Refactor OrgsController#admin_update#3529
Open
aaronskiba wants to merge 4 commits intoDMPRoadmap:next-release/v5.0.3from
Open
Conversation
attrs[:managed] on Org updatesattrs[:managed] + Refactor OrgsController#admin_update
475ce66 to
9b6d23f
Compare
This change resolves issue DMPRoadmap#3528 by preventing the updating of `@org.managed` when `attrs[:managed]` is missing. Prior to this change, the `if attrs.key?(:managed)` was not present. But it was necessary, because that key is not present when a super user clicks "Save" on the "Request Feedback" page. - As a result, if `attrs[:managed]` was not present, then `attrs[:managed] = (attrs[:managed] == '1')` would evaluate false, and `if @org.update(attrs)` (line 81) would subsequently update `@org.managed` to false in the db.
This refactor is meant to serve as a small step in simplifying `OrgsController#admin_update` controller action, which currently contains a lot of rubocop offences. - Moved `attrs[:logo]` handling logic into `handle_logo(attrs)` - Moved Shibboleth identifier handling into `handle_shibboleth_identifier(attrs)`
9b6d23f to
5da1ba8
Compare
johnpinto1
approved these changes
Nov 14, 2025
Contributor
There was a problem hiding this comment.
Super admin's view an Organisation details:
Refactoring and fix working fine for missing "Managed".
Not sure why "Managed" is cited as a mandatory field. (Is it worthwhile removing the asterisk?).
Also it looks like you can never save if the mandatory field "Contact email" is missing, but you can if "Link text" is missing. I guess this is something added in past, super admins are fine with this convention.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #3528
Changes proposed in this PR:
Org.managedto false #3528 by preventing the updating of@org.managedwhenattrs[:managed]is missing. Prior to this change, theif attrs.key?(:managed)was not present. But it was necessary, because that key is not present when a super user clicks "Save" on the "Request Feedback" page.attrs[:managed]was not present, thenattrs[:managed] = (attrs[:managed] == '1')would evaluate false, andif @org.update(attrs)(line 81) would subsequently update@org.managedto false in the db.